package util

import "fmt"

var LoadBanlance *loadBanlance
type HttpServer struct {
	Host string
}

func NewHttpServer(host string) HttpServer {
  return HttpServer{Host:host}
}
type loadBanlance struct {
	HttpServers []*HttpServer
}

func NewBanlance() *loadBanlance  {
  return &loadBanlance{HttpServers:make([]*HttpServer,0)}
}

func (this *loadBanlance) AddHttpServer(server *HttpServer){
	this.HttpServers = append(this.HttpServers, server)
}
var    index=0

func (this *loadBanlance) SelectHttpServerByQuery() *HttpServer{
	//fmt.Println(this.HttpServers)
	fmt.Println("select")
	if index>2 {
		index = 0
	}
	server := this.HttpServers[index]
	fmt.Println(server.Host)
	fmt.Println(index)

index++
   return server
}

func init(){

}